package com.rdc.qingkou.adapter;


import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.Log;

import com.rdc.qingkou.view.fragment.MeSubscribeFragment;
import com.rdc.qingkou.view.fragment.SubscribeMeFragment;

public class SubscribeFragmentViewPagerAdapter extends FragmentPagerAdapter{

    final int PAGE_COUNT = 2;
    private String tabTitles[] = new String[]{"我订阅的","订阅我的"};
    private Context context;

    public SubscribeFragmentViewPagerAdapter(FragmentManager fm, Context context) {
        super(fm);
        this.context = context;
    }

    //!!!
    @Override
    public Fragment getItem(int position) {
        Log.d("Subscribe...Adapter","position is : " + Integer.toString(position));
//        return MeSubscribeFragment.newInstance(position + 1);

        if (position == 0){
            return MeSubscribeFragment.newInstance(position);
        }else{
            return SubscribeMeFragment.newInstance(position);
        }
    }

    @Override
    public int getCount() {
        return PAGE_COUNT;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabTitles[position];
    }
}
